package com.gp.pj.mapper;

import com.gp.pj.entity.Role;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gp.pj.vo.RoleVo;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Chloe
 * @since 2020-12-07
 */
public interface RoleMapper extends BaseMapper<Role> {

    @Select("SELECT r.id as id, r.name as name, r.title as title, r.description as description, GROUP_CONCAT(m.id) as menu  FROM t_role r " +
            "LEFT JOIN t_menu_role mr ON mr.role_id = r.id LEFT JOIN t_menu m ON m.id = mr.menu_id GROUP BY r.id")
    List<RoleVo> roleList();

}
